package com.qo.qsdk.ui.base.floater.ctrl;

import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.ImageButton;

import androidx.appcompat.widget.AppCompatImageButton;

import com.qo.qsdk.ui.base.floater.parameters.AssistorViewParameters;
import com.qo.qsdk.utils.DynamicUtils;


public class AssistorView extends AppCompatImageButton {

    public static Place mPlace = Place.NONE;
    private Drawable mNormalIconDrawable = null;
    private Drawable mExpandedIconDrawable = null;

    public enum Place {
        NONE,
        LEFT,
        RIGHT
    }

    public AssistorView(Activity context, AssistorViewParameters parameters) {
        super(context);

        mPlace = Place.NONE;
        getNormalIconDrawable(context, parameters.getNormalIcon(), parameters.getSelectedIcon());
        getExpandedIconDrawable(context, parameters.getExpandedIcon(), parameters.getSelectedExpandedIcon());
        setNormalBackgroundDrawable();
    }

    private void getNormalIconDrawable(Activity activity, String normal, String selected) {
        mNormalIconDrawable = DynamicUtils.getDrawable(activity, normal);
    }

    private void getExpandedIconDrawable(Activity activity, String normal, String selected) {
        mExpandedIconDrawable = DynamicUtils.getDrawable(activity, normal);
    }

    public void setNormalBackgroundDrawable() {
        setBackgroundDrawable(mNormalIconDrawable);
    }

    public void setNormalBackgroundDrawable(Activity activity, String str) {
        getNormalIconDrawable(activity, str, "");
        setNormalBackgroundDrawable();
    }


}
